package com.yj.springbootredis.rest;

import lombok.Data;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
public class MyController {

    private static  List<OneInfo>list = null;

    static {

        list = new ArrayList<>();
        OneInfo oneInfo = new OneInfo();
        oneInfo.setId(1);
        oneInfo.setPath("/test1");
        oneInfo.setName("财务报表");

        OneInfo oneInfo2 = new OneInfo();
        oneInfo2.setId(2);
        oneInfo2.setPath("/test2");
        oneInfo2.setName("报表批注");


        //
        TwoInfo twoInfo1 = new TwoInfo();
        twoInfo1.setId(11);
        twoInfo1.setPath("/test11");
        twoInfo1.setName("盈利规模（归属母公司净利润）");
        twoInfo1.setNumber(0);
        TwoInfo twoInfo2 = new TwoInfo();
        twoInfo2.setId(12);
        twoInfo2.setPath("/test12");
        twoInfo2.setName("经营性现金流净额");
        twoInfo2.setNumber(0);
        TwoInfo twoInfo3 = new TwoInfo();
        twoInfo3.setId(13);
        twoInfo3.setPath("/test11");
        twoInfo3.setName("经营性现金流净额（上一年）");
        twoInfo3.setNumber(0);

        //
        TwoInfo twoInfo4= new TwoInfo();
        twoInfo4.setId(21);
        twoInfo4.setPath("/test21");
        twoInfo4.setName("担保总额占jin");
        twoInfo4.setNumber(0);
        TwoInfo twoInfo5 = new TwoInfo();
        twoInfo5.setId(22);
        twoInfo5.setPath("/test22");
        twoInfo5.setName("呃呃呃呃呃呃呃呃呃呃");
        twoInfo5.setNumber(0);


        ArrayList<TwoInfo> twoInfos = new ArrayList<>();
        twoInfos.add(twoInfo1);
        twoInfos.add(twoInfo2);
        twoInfos.add(twoInfo3);
        oneInfo.setTwoInfos(twoInfos);

        ArrayList<TwoInfo> twoInfos2 = new ArrayList<>();
        twoInfos2.add(twoInfo4);
        twoInfos2.add(twoInfo5);
        oneInfo2.setTwoInfos(twoInfos2);

        list.add(oneInfo);
        list.add(oneInfo2);
    }

    @GetMapping("get")
    public List get(){
        return this.list;
    }

}

@Data
class OneInfo {
    private Integer id;
    private String path;
    private String name;
    private List<TwoInfo> twoInfos;
}
@Data
class TwoInfo {
    private Integer id;
    private String path;
    private String name;
    private Integer number;
}
